Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SPDX v2.3 #353

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

CarolinaOliiveira
Copy link

@CarolinaOliiveira CarolinaOliiveira commented Sep 9, 2024

Upgrade SPDX to version 2.3

This PR was developed to update SPDX implementation from version 2.2 to version 2.3. In this link, differences between these two versions are listed, where only the first four are relevant since annexes have not been implemented. In the following section, I’ll briefly explain the changes to version 2.3.

  1. Added four new fields to Package Information: Primary Package Purpose, Built Date, Release Date, Valid Until Date.

    • Primary Package Purpose - This field provides information about the primary purpose of the identified package. Package Purpose is intrinsic to how the package is being used rather than the content of the package. The possible values for this field are APPLICATION, FRAMEWORK, LIBRARY, CONTAINER, OPERATING-SYSTEM, DEVIDE, FIRMWARE, SOURCE, ARCHIVE, FILE, INSTALL and OTHER.
    • Built Date - This field provides a place for recording the actual date the package was built.
    • Release Date - This field provides a place for recording the date the package was released.
    • Valid Until Date - This field provides a place for recording the end of the support period for a package from the supplier.
  2. Added eight hash algorithms (SHA3-256, SHA3-384, SHA3-512, BLAKE2b-256, BLAKE2b-384, BLAKE2b-512, BLAKE3, ADLER32) to the set recognized by Package Checksum field and File checksum field.

  3. Update Package Information, File Information and Snippet information to make several of the licensing properties optional rather than requiring the use of "NOASSERTION" when no value is provided. The required fields for these sections are now:

  4. Update Relationships between SPDX elements to add the new relationship types: REQUIREMENT_DESCRIPTION_FOR and SPECIFICATION_FOR.

Support for version 2.2:

  • SPDX JSON is still valid for 2.2 since only non-required fields were added. But for xml, 2.2 is no longer valid since it has to respect an order and some field's order changed.
  • Although SPDX 2.2 is still valid for JSON, once you deserialize it, it will automatically be converted to version 2.3, keeping the same information it already had, the only change is in the field spdxVersion.
  • SPDX 2.2 JSON can still be converted to CycloneDX, but Cyclone will have the information that the SPDX version was 2.3.
  • If you convert SPDX to CycloneDX and back to SPDX, the converted SPDX version will be 2.3.

…92734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…34+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
… <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…ers.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…er.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…inaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
Add Built Date, Release Date and Valid Until Date fields
Make Packages and files properties opctional
Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
… Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…ra <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…Oliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…Oliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…rolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…inaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…aOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…y: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
@p-brito
Copy link

p-brito commented Sep 10, 2024

@coderpatros @stevespringett can you review this?

src/CycloneDX.Spdx/Models/v2_3/SpdxDocument.cs Outdated Show resolved Hide resolved
src/CycloneDX.Spdx/Models/v2_3/SpdxDocument.cs Outdated Show resolved Hide resolved
src/CycloneDX.Spdx/Models/v2_3/Annotation.cs Outdated Show resolved Hide resolved
src/CycloneDX.Spdx/CycloneDX.Spdx.csproj Outdated Show resolved Hide resolved
…-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…2734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
@mtsfoni
Copy link
Contributor

mtsfoni commented Sep 14, 2024

First of all thank you for the contribution.

I currently maintain this project, however I know only very little about SPDX.

Can you(eg. @Kiril1512) assure me, that you reviewed the code good and deep enough and @CarolinaOliiveira, that you can take time to fix bugs that might arrise from the integration of your code?

@andreas-hilti
Copy link
Contributor

@mtsfoni What is the strategy here with respect to version support? Support only the latest 2.x version of SPDX (or is the aim to support both 2.2 and 2.3)?

…liiveira@users.noreply.github.com>

added spdx json validator testsfor v2.2 and invalid package purpose; added converter tests from spdx v2.2 to cyclonedx

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
…iiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
@p-brito
Copy link

p-brito commented Sep 20, 2024

@andreas-hilti the code was built to support only the latest version, if we want to support both 2.2 and 2.3 it will require a lot more work.

@Kiril1512
Copy link

Hello @mtsfoni

Me and @p-brito did an extended review and also @CarolinaOliiveira updated the PR description so it will be much easier for you to navigate what was changed and allow a smoother review.
Also, we tested the dll's in our internal services for energetic SPDX and cycloneDx and parsed them and everything works as expected.

This is not the first time we have contributed to this repo Add support to SPDX.xml so we can assure maintenance and bug fixing that may rise.

…<61292734+CarolinaOliiveira@users.noreply.github.com>

Signed-off-by: Carolina Oliveira <61292734+CarolinaOliiveira@users.noreply.github.com>
@p-brito
Copy link

p-brito commented Oct 2, 2024

@mtsfoni can you please review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants